package com.picturestory.client.android;

import com.picturestory.client.android.auth.Auth;
import com.picturestory.client.android.post.PostArticle;
import com.picturestory.client.android.registration.ServiceInfo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class Dashboard extends Activity {

	private static final int MENU_STATUS = 1;
	private static final int MENU_CONNECTION_TEST = 2;
	private static final int MENU_SIGNUP = 3;
	private static final int MENU_AUTH = 4;
	private static final int MENU_POST_ARTICLE = 5;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.dashboard);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		
		menu.add(0, Dashboard.MENU_STATUS,          0, "Status").setIcon(android.R.drawable.ic_menu_info_details);
		menu.add(0, Dashboard.MENU_SIGNUP,          0, "Signup").setIcon(android.R.drawable.ic_menu_add);
		menu.add(1, Dashboard.MENU_CONNECTION_TEST, 0, "HTTP Test").setIcon(android.R.drawable.ic_menu_send);
		menu.add(2, Dashboard.MENU_AUTH,            0, "Authentication").setIcon(android.R.drawable.ic_menu_manage);
		menu.add(0, Dashboard.MENU_POST_ARTICLE,    0, "Posting").setIcon(android.R.drawable.ic_menu_edit);
		
		return true;
		
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch(item.getItemId()) {
		case Dashboard.MENU_STATUS:
			startActivity(new Intent(Dashboard.this, Status.class));
			break;
		case Dashboard.MENU_CONNECTION_TEST:
			startActivity(new Intent(Dashboard.this, HttpConnectionTest.class));
			break;
		case Dashboard.MENU_SIGNUP:
			startActivity(new Intent(Dashboard.this, ServiceInfo.class));
			break;
		case Dashboard.MENU_AUTH:
			startActivity(new Intent(Dashboard.this, Auth.class));
			break;
		case Dashboard.MENU_POST_ARTICLE:
			startActivity(new Intent(Dashboard.this, PostArticle.class));
			break;
		}
		
		return super.onMenuItemSelected(featureId, item);
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	
}
